function rate(integer) {
	document.getElementById('custrecordreviewrating').value = integer;
}

function showSelection() {
	var index = document.getElementById('custrecordreviewrating').value;
	var elements = this.getElementsByTagName('a');
	var addClass = true;
	for ( var i = 0; i < elements.length; i++) {
		if (i == index)
			addClass = false;
		if (addClass) {
			elements[i].className = 'selected';
		} else {
			elements[i].className = '';
		}
	}
}

function ratingHover() {
	var element = this;
	var container = element.parentNode;
	var elements = container.getElementsByTagName('a');
	var addClass = true;
	for ( var i = 0; i < elements.length; i++) {
		if (addClass) {
			elements[i].className = 'hover';
			if (elements[i] == element) {
				addClass = false;
			}
		} else {
			elements[i].className = '';
		}
	}
}

function ratingSelect() {
	var element = this;
	var container = element.parentNode;
	var elements = container.getElementsByTagName('a');
	var addClass = true;
	for ( var i = 0; i < elements.length; i++) {
		if (addClass) {
			elements[i].className = 'selected';
			if (elements[i] == element)
				addClass = false;
		} else {
			elements[i].className = '';
		}
	}
}

var stars = document.getElementById('starrating');
stars.onmouseout = showSelection;
var elements = stars.getElementsByTagName('a');
for ( var i = 0; i < elements.length; i++) {
	elements[i].onclick = ratingSelect;
	elements[i].onmouseover = ratingHover;
}

function showCouponComments(id) {
	if ($('#coupon_comment' + id).is(':hidden')) {
		$('#coupon_comment' + id).slideDown(600);
//		$('#toggle_arrow' + id).attr('class', 'arrow-down');
	} else {
		$('#coupon_comment' + id).slideUp(600);
//		$('#toggle_arrow' + id).attr('class', 'arrow-up');
	}
}

function showShare(id) {
	if ($('#share_' + id).is(':hidden')) {
		$('#share_' + id).slideDown(600);
//		$('#toggle_arrow' + id).attr('class', 'arrow-down');
	} else {
		$('#share_' + id).slideUp(600);
//		$('#toggle_arrow' + id).attr('class', 'arrow-up');
	}
}

function showActionBox(id) 
{
	var actionBox = $('#actionBox' + id);
	actionBox.show();
}
function hiddenActionBox(id) 
{
	var actionBox = $('#actionBox' + id);
	actionBox.hide();
}